home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 2,801 to 2,900
/
aol-file-protocol-4400-2801-to-2900.zip
/
AOLDLs
/
C++ Files Library
/
Acere (PowerPlant, Game) 1.2
/
AcereÄ.sit
/
Acereƒ
/
Code
/
WellFreeCell.cp
< prev
next >
Wrap
Text File
|
1995-02-15
|
5KB
|
179 lines
// ===========================================================================
// WellFreeCell.cp ⌐1993 Metrowerks Inc. All rights reserved.
// ===========================================================================
//
// Class for an object that can draw itself and respond to mouse clicks
#ifdef PowerPlant_PCH
#include PowerPlant_PCH
#endif
#include "WellFreeCell.h"
#include "CardDeck.h"
#include "AcereApp.h"
#include "CTextDoc.h"
#include <LView.h>
#include <LStream.h>
#include <PP_Messages.h>
#include <UDrawingState.h>
#include <Balloons.h>
extern CTextDoc *theDoc;
extern unsigned long ourAvailRam;
// ---------------------------------------------------------------------------
// Ñ CreatePaneStream [static]
// ---------------------------------------------------------------------------
// Return a new Pane object initialized using data from a Stream
WellFreeCell*
WellFreeCell::CreateWellFreeCell(
LStream *inStream)
{
return (new WellFreeCell(inStream));
}
// ---------------------------------------------------------------------------
// Ñ WellFreeCell()
// ---------------------------------------------------------------------------
// Default Constructor
WellFreeCell::WellFreeCell() : CardWell()
{
InitCard();
theWellHelp.hmmHelpType = khmmString;
CopyPString("\pMove any card here for temporary storage.", (StringPtr)theWellHelp.u.hmmString);
}
// ---------------------------------------------------------------------------
// Ñ WellFreeCell(const WellFreeCell&)
// ---------------------------------------------------------------------------
// Copy Constructor
WellFreeCell::WellFreeCell(
const WellFreeCell &inOriginal) : CardWell(inOriginal)
{
// Copy members of Original
InitCard();
}
// ---------------------------------------------------------------------------
// Ñ WellFreeCell(SPaneInfo&)
// ---------------------------------------------------------------------------
// Construct Pane from data in a struct
WellFreeCell::WellFreeCell(const SPaneInfo &inPaneInfo) : CardWell(inPaneInfo)
{
InitCard();
}
// ---------------------------------------------------------------------------
// Ñ WellFreeCell(LStream*)
// ---------------------------------------------------------------------------
// Construct Pane from data in a Stream
WellFreeCell::WellFreeCell(
LStream *inStream) : CardWell(inStream)
{
// SPaneInfo thePaneInfo;
// inStream->ReadData(&thePaneInfo, sizeof(SPaneInfo));
InitCard();
}
// ---------------------------------------------------------------------------
// Ñ InitPane
// ---------------------------------------------------------------------------
// Initialize Pane from data in a struct
void
WellFreeCell::InitCard(void)
{
// CardWell::InitPane(inPaneInfo);
theDoc->theFreeCells[theDoc->currentFreeCell] = this;
theDoc->currentFreeCell++;
}
// ---------------------------------------------------------------------------
// Ñ ~WellFreeCell
// ---------------------------------------------------------------------------
// Destructor
WellFreeCell::~WellFreeCell()
{
PutInside(nil);
if (sLastPaneClicked == this) {
sLastPaneClicked = nil;
}
}
// ---------------------------------------------------------------------------
// Ñ Draw
// ---------------------------------------------------------------------------
// Try to draw contents of a Pane
//
// inSuperDrawRgnH specifies, in Port coordinates, the portion of the
// Pane's SuperView that needs to be drawn. Specify nil to bypass
// the intersection test.
//
// This is a wrapper function which calls DrawSelf if it is proper for
// the Pane to draw. This means that:
// > Pane's Visible property is on
// > Pane can be focused
// > Pane's Frame is in QuickDraw space
// > Pane's Frame intersects inSuperDrawRgnH
/*void WellFreeCell::Draw(RgnHandle inSuperDrawRgnH)
{
Rect frame;
if ( IsVisible() &&
FocusDraw() &&
CalcPortFrameRect(frame) &&
((inSuperDrawRgnH == nil) || RectInRgn(&frame, inSuperDrawRgnH)) )
{
if (itsCard == nil)
{
EraseRect(&frame);
FrameRoundRect(&frame, 20, 20);
}
else if (itsCard->card == kNoCard)
{
EraseRect(&frame);
FrameRoundRect(&frame, 20, 20);
}
else
{
theDeck->DrawCard(itsCard, frame, isHighlighted);
FrameRoundRect(&frame, 20, 20);
}
}
}
*/
void WellFreeCell::AdjustCursor(Point inPortPt, const EventRecord &inMacEvent)
{
OSErr theErr;
Point tempPoint;
inherited::AdjustCursor(inPortPt, inMacEvent);
if (theApp->balloonsActive)
{
LocalToGlobal(& topLeft(itsHelpRect));
LocalToGlobal(& botRight(itsHelpRect));
SetPt(&tempPoint, itsHelpRect.right -3, itsHelpRect.bottom -3);
theErr = HMShowBalloon(&theWellHelp, tempPoint, &itsHelpRect, nil, nil, 0, kHMRegularWindow);
}
}